<template>
    <div>
        <a-input :style="{width:'320px'}" v-model="inputComponent" :placeholder="placeholder" allow-clear @keyup.enter="handleSubmit" />
    </div>
</template>

<script setup>
import { ref } from 'vue';

// 属性也是一个只读的响应式变量
const props = defineProps({
    placeholder: String,
})

// 用户输入的值
const inputComponent = ref('')

// 定义一个事件
const emits = defineEmits(['update:placeholder'])
const handleSubmit = () => {
    emits('update:placeholder', inputComponent.value)
}

console.log(props.placeholder) 

</script>

<style lang="scss" scoped>

</style>